<html>
<head>
    <title>
        <?php echo "$title"; ?>
    </title>
</head>
<body>
  <div id="one_group_div">
    <?php
        $group_id = $group_info['group_id'];
        $group_name = $group_info['group_name'];
        $group_desc = $group_info['group_desc'];
    ?>
    
    <?php
        $img_props = array (
            'src' => 'resources/images/backButton.png',
            'alt' => 'Back Button',
            'class' => 'post_image',
            'width' => '50',
            'height' => '50'
        );
                  
        echo "<div class='back_img' title='Back to Groups'><a href='".site_url()."authenticated/groups'>".img($img_props)."</a></div>"; 
    ?> 
    <p id="one_group_name"><?php echo $group_name; ?></p>
    <p id="one_group_desc"><?php echo $group_desc; ?></p>
<!--    <div id="admins_list_area">
        <p id="p_people_header">People who manage this Group:</p>
        <?php 
            foreach($admins as $admin) {
               echo "<p class='who_manage_inst'>".$admin['lname']." ".$admin['fname']."</p>";
            }
        ?>
    </div>-->

<p><?php echo $links; ?></p>
    <?php
    
        if($posts == null || count($posts) == 0) {
            echo "<p id='p_no_post'>There are currently no posts in this group.</p>";
        }
        else {
            foreach($posts as $post) {
                $title = $post['title'];
                $post_id = $post['post_id'];
                $summary = $post['summary'];
                $full_text = $post['full_text'];
                $month = date('F', strtotime($post['date_time_pub']));
                $year = date('Y', strtotime($post['date_time_pub']));
                $day =  date('d', strtotime($post['date_time_pub']));
            ?>
    
            <div id='one_post'>
                <div class='date_box'>
                    <p id="date_text"><?php echo $day; ?></p>
                    <p id="month_text"><?php echo $month; ?></p>
                    <p id="year_text"><?php echo $year; ?></p>
                </div>
                    
                <div class='post_box'>
                  <?php
                    $img_props = array (
                        'src' => 'resources/images/post.png',
                        'alt' => 'Group Post',
                        'class' => 'post_image',
                        'width' => '50',
                        'height' => '50'
                    );
                  
                    echo "<div class='post_img'>".img($img_props)."</div>"; 
                    
                    
                  echo "<p class='post_title2'><a href=".site_url()."authenticated/group_post/read_full_story/$post_id>$title</a></p>";
                  ?>
                  <p class="post_summary_text"><?php echo $summary; ?>...
                      <a href="<?php echo site_url(); ?>authenticated/group_post/read_full_story/<?php echo $post_id; ?>" class="viewFull">View Full</a></p>
                  
                  
<!--                  <form action='<?php echo site_url(); ?>authenticated/group_post/read_full_story/<?php echo $post_id; ?>' method="post">
                    <input type='submit' class='btnViewFull' name='btnViewFull' value='View Full Story' />
                  </form>-->
                </div>
            </div>
<hr />
              
            <?php }
        }
    ?>
  </div>      

<script>
  var tiles1 = document.getElementsByClassName('date_box');
  
  for(var i = 0; i < tiles1.length; i++) {
      var tile = tiles1[i];
      var color = get_random_color();
      tile.style.background = get_random_color();
  }

function get_random_color() {
    var letters = '5678abc'.split('');
    var color = '#';
    for (var i = 0; i < 6; i++ ) {
        color += letters[Math.round(Math.random() * 6)];
    }
    return color;
}


</script>
 
</body>

</html>